<?php 
include_once('connection/connection.php');
include('header.php');
include('menu.php');
include('config.php');
$frm=$_SESSION['form_id'];
$id1=$_SESSION['id1'];
$dis_name=$_SESSION['dis_name'];
$qr="select * from tbl_dtls_q1_main where form_id='$frm'";
$res=mysql_query($qr);
$row=mysql_fetch_array($res);
if(isset($_POST['back']))
{ 
	header('Location: view_q1_3.php');
}	
if(isset($_POST['submit']))
{ 
	echo'<span class="successmssg">You have successfully view this Form. Now you can go on <a href="home.php">home</a> page.</span>';
	exit();
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/style_question.css" type="text/css" rel="stylesheet" />
<title>View Q1</title></head>
<script language=javascript>
function show_NF()
{
	var val=document.getElementById('num').value;
	for(i=1; i<val; i++)
	{
		//alert(document.getElementById('critical'+i).innerHTML);
		if(document.getElementById('critical'+i).innerHTML == "no")
		{
			document.getElementById('crit'+i).style.display = "none";
		}
		else
		{
			document.getElementById('crit'+i).style.display = "block";
		}
		
	}
}
</script>
</head>
<body onLoad="show_NF()">
<div align="center">
<form name="f1" action="" method="post">
	<table border="0" width="750" id="table1" cellspacing="0" cellpadding="0">
		<tr>
			<td height="30" colspan="3">
			<p align="center">
			<font face="Verdana" style="font-size: 10pt; font-weight: 700" color="#000000">
			Questionnaire No. 1</font></td>
		</tr>		
		<tr>
			<td colspan="3" align="center"><font face="Arial" style="font-size: 8.5pt" color="#000000">(For PHED Officials)</font></td>
		</tr>
		<tr>
			<td colspan="3"align="center"><font face="Arial" style="font-size: 8.5pt" color="#000000">page 4</font></td>
		</tr>
		<tr>
			<td><span style="font-weight: 700">
			<font face="Arial" style="font-size: 8.5pt" color="#000000">&nbsp;&nbsp;Form Id = <?php echo $frm?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;District Name = <?php echo $dis_name?></font></span></td>
		</tr>
		<tr><td>&nbsp;</td></tr>
		<tr>
			<td height="22" colspan="2" bgcolor="#EEEEEE"><font color="#000000">&nbsp;
			<span style="font-weight: 700">
			<font face="Arial" style="font-size: 8.5pt">Critical Habitations</font></span>
			</font></td>
		</tr>
		<tr>
			<td colspan="2">
				<table border="1" width="761" id="table2" bgcolor="#FDF9EE" cellspacing="1" cellpadding="0" style="border-collapse:collapse; border-color:#99CCCC;">
					<tr>
						<!--<td colspan="5">
							<span style="font-size: 4pt">&nbsp;</span>
						</td>-->
						<td width="201" height="28" align="center"  bgcolor="#F7E6B7">
							<font face="Verdana" style="font-size: 8.5pt" color="#990000">
							Habitation Name</font></td>
						<td width="109" align="center"  bgcolor="#F7E6B7"><font face="Verdana" style="font-size: 8.5pt" color="#990000">Habitation Type</font></td>
						<td width="439"  bgcolor="#F7E6B7" align="center">
							<font face="Verdana" style="font-size: 8.5pt" color="#990000">
							Critical</font></td>
					</tr>
					<?php
						$qr2="select * from tbl_dtls_q1_critical where loc_id='$id1' order by critical_hcode asc";
						$res2=mysql_query($qr2);
						$i=1;
						while($row=mysql_fetch_array($res2))
						{
					?>
				<tr align="center">
				  <td width="201" height="26"><label id="critical_hname"><font face="Arial" style="font-size: 8.5pt">&nbsp;<?php echo "$row[critical_hname]";?></font></label></td>
				    <td align="center" width="109"><label id="type_habit"><font face="Arial" style="font-size: 8.5pt">&nbsp;<?php echo "$row[type_habit]";?></font></label></td>
				    <td width="439"><label id="critical<?php echo $i ?>" for="<?php echo "$row[critical]";?>"><font face="Arial" style="font-size: 8.5pt">&nbsp;<?php echo "$row[critical]";?></font></label></td>
				</tr> 
					<tr>
						<td></td>
						<td></td>
						<td><div id="crit<?php echo $i ?>">
							<table border="1" width="100%" id="table16" cellpadding="0" style="border-collapse:collapse; border-color:#99CCCC;">
							<tr>
								<td height="22" colspan="" align="center">
								<font face="Verdana" style="font-size: 8.5pt" color="#990000">&nbsp; 
								Critical Village in terms of quality </font>							                        		</td>
							</tr>
							<tr>
								<td width="93" height="24" align="center"><div align="center"></div><label id="CH_quality"><font face="Arial" style="font-size: 8.5pt">&nbsp;<?php echo "$row[CH_quality]";?></font></label></td>
							</tr>
							<tr>
								<td height="26" colspan="0" align="center">&nbsp;
								<font face="Verdana" style="font-size: 8.5pt" color="#990000">
								Critical Village in terms of quantity </font>            						                       			</td>
							</tr>
							<tr>
								<td height="26" colspan="0" align="center"><label id="CH_quality"><font face="Arial" style="font-size: 8.5pt">&nbsp;<?php echo "$row[CH_quantity]";?></font></label></td>
				    		</tr>
						</table>
						</div></td>
				</tr>
				<?php
				$i++;
					} ?>
					<input type="hidden" name="num" id="num" value="<?php echo $i;?>">
			</table>		</td>
	</tr>
		<tr>
			<td height="19" colspan="2"><span style="font-size: 4pt">&nbsp;</span></td>
		</tr>
		<tr>
			<td width="207" height="23"  colspan="2" bgcolor="#EEEEEE"><font color="#000000">&nbsp;
				<span style="font-weight: 700">
				<font face="Arial" style="font-size: 8.5pt">Water Supply by Tankers</font></span></font></td>
		    <!--<td width="543"><label id="constraint_operational"><?php //echo "$row[constraint_operational]";?></label></td>-->
		</tr>
		<tr>
			<td height="15" colspan="2"><span style="font-size: 3pt">&nbsp;</span></td>
		</tr>
		<tr>
			<td colspan="2">
				<table border="1" width="100%" id="table6" bgcolor="#FDF9EE" cellspacing="1" cellpadding="0" style="border-collapse:collapse; border-color:#99CCCC;">
					<tr>
						<td height="64">
							<table border="1"  width="100%" id="table8" cellpadding="0" bgcolor="#FDF9EE" cellspacing="1" style="border-collapse:collapse; border-color:#99CCCC;">
								<tr>
								<td><div id="tanker">
                           		 <table border="1" width="750" style="border-collapse:collapse; border-color:#99CCCC;">
                               	 <tr>
									<td width="201" height="29" align="center"  bgcolor="#F7E6B7">
										<font face="Verdana" style="font-size: 8.5pt" color="#990000">
										Habitation Name</font></td>
										<td width="113" align="center"  bgcolor="#F7E6B7"><font face="Verdana" style="font-size: 8.5pt" color="#990000">Habitation Type</font></td>
									<td width="120"  bgcolor="#F7E6B7" align="center">
										<address>
										<span style="font-style: normal">
										<font face="Verdana" style="font-size: 8.5pt" color="#990000">
										Tanker Nos.</font></span>
										</address>								  </td>
									<td width="139"  bgcolor="#F7E6B7" align="center">
										<address><span style="font-style: normal">
										<font face="Verdana" style="font-size: 8.5pt" color="#990000">
										Quantity (KL)</font></span></address>								  </td>
									<td width="169"  bgcolor="#F7E6B7" align="center">
										<address><span style="font-style: normal">
										<font face="Verdana" style="font-size: 8.5pt" color="#990000">
										Area Covered</font></span></address>								  </td>
								</tr>
								
				<?php
						$qr2="select * from tbl_dtls_q1_tanker where loc_id='$id1' order by habitation_code asc";
						$res2=mysql_query($qr2);
						while($row=mysql_fetch_array($res2))
						{
					?>
								<tr align="center">
									<td width="224" height="30"><label id="habitation_name"><font face="Arial" style="font-size: 8.5pt">&nbsp;<?php echo "$row[habitation_name]";?></font></label></td>
                                  <td align="center" width="125"><label id="type_habit"><font face="Arial" style="font-size: 8.5pt">&nbsp;<?php echo "$row[type_habit]";?></font></label></td>
                                  <td width="125"><label id="total_tanker_no"><font face="Arial" style="font-size: 8.5pt">&nbsp;<?php echo "$row[total_tanker_no]";?></font></label></td>
                                  <td width="99"><label id="water_quantity"><font face="Arial" style="font-size: 8.5pt">&nbsp;<?php echo "$row[water_quantity]";?></font></label></td>
                                  <td width="169"><label id="area_covered"><font face="Arial" style="font-size: 8.5pt">&nbsp;<?php echo "$row[area_covered]";?></font></label></td>
								</tr>
								<?php
								} ?>
								<input type="hidden" name="habcount" id="habcount" value="<?php echo                                $i; ?>">
								</table>
								</div></td></tr>
						</table>
					</td>
				</tr>
			</table>		</td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr>
		<td colspan="2">
			<table border="1" width="100%" id="table4" cellspacing="1" cellpadding="0" bgcolor="#FDF9EE" style="border-collapse:collapse; border-color:#99CCCC;">
			</table>		</td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr>
		<td colspan="0" align="center">
		<input type="submit" value="Back" name="back" style="font-size: 8pt;font-family:Verdana; border-style: solid; border-width: 1px">&nbsp;&nbsp;
			<input type="submit" value="Next" name="submit" style="font-size: 8pt;font-family:Verdana; border-style: solid; border-width: 1px">
		</td>
	</tr>
</table>
</form>
</div>
</body>
</html>